package top.ochiamalu.aioj.service;

import com.baomidou.mybatisplus.extension.service.IService;
import top.ochiamalu.aioj.domain.dto.judge.JudgeDTO;
import top.ochiamalu.aioj.domain.dto.judge.TestCodeDTO;
import top.ochiamalu.aioj.domain.entity.JudgeCode;
import top.ochiamalu.aioj.domain.vo.judge.ExecuteCodeVO;
import top.ochiamalu.aioj.domain.vo.judge.SubmitHistoryVO;
import top.ochiamalu.aioj.domain.vo.judge.SubmitVO;
import top.ochiamalu.aioj.domain.vo.judge.TestCodeVO;

/**
 * 判题服务
 *
 * @author ochiamalu
 * @date 2025/01/24
 */
public interface JudgeService extends IService<JudgeCode> {

    /**
     * 判题
     *
     * @param judgeDTO 执行代码dto
     * @param submissionId   提交id
     */
    void judgeCode(JudgeDTO judgeDTO, String submissionId);

    /**
     * 得到判题结果
     *
     * @param submissionId 提交id
     * @return {@link ExecuteCodeVO }
     */
    ExecuteCodeVO getJudgeResult(String submissionId);

    /**
     * 获取提交信息
     *
     * @param judgeDTO 执行代码dto
     * @param submissionId   提交id
     * @return {@link SubmitVO }
     */
    SubmitVO getSubmitInfo(JudgeDTO judgeDTO, String submissionId);

    /**
     * 测试代码
     *
     * @param testCodeDTO 测试代码dto
     */
    TestCodeVO testCode(TestCodeDTO testCodeDTO);

    /**
     * 得到上一次判题结果
     *
     * @return {@link ExecuteCodeVO }
     */
    ExecuteCodeVO getLastJudgeResult(Long questionId);

    /**
     * 具有最后判题结果
     *
     * @param questionId 题目ID
     * @return boolean
     */
    boolean hasLastJudgeResult(Long questionId);

    /**
     * 获取提交历史记录
     *
     * @param account 账户
     * @return {@link SubmitHistoryVO }
     */
    SubmitHistoryVO getSubmitHistory(String account);

    /**
     * 判题选择
     *
     * @param judgeDTO     判题DTO
     * @param submissionId 提交id
     */
    void judgeChoice(JudgeDTO judgeDTO, String submissionId);

    /**
     * 判题判断
     *
     * @param judgeDTO     判题DTO
     * @param submissionId 提交id
     */
    void judgeJudgement(JudgeDTO judgeDTO, String submissionId);

    /**
     * 判题填空
     *
     * @param judgeDTO     判题DTO
     * @param submissionId 提交id
     */
    void judgeFillBlank(JudgeDTO judgeDTO, String submissionId);

    /**
     * 判题综合
     *
     * @param judgeDTO     判题DTO
     * @param submissionId 提交id
     */
    void judgeComprehensive(JudgeDTO judgeDTO, String submissionId);
}
